

struct List {
    int b;
    List *next;
    List *prev;
};

// a -> b -> c
// a -> b -> d -> c

void insert( List *list, int f ) {
    List *l = new List;
    l->next = list->next;
    l->prev = list;
    if ( list->next ) {
	list->next->prev = l;
    }
    list->next = l;
}

void remove ( List *list ) {
    if ( list->prev ) {
	list->prev->next = list->next;
    }
    if ( list->next ) {
	list->next->prev = list->prev;
    }
    delete list;
}

// typedef uint32_t unsigned;

uint32_t byteswap( uint32_t in ) {
    uint8* p = &in;
    uint8 t;
    t = p[3];
    p[3] = p[0];
    p[0] = t;
    t = p[2];
    p[2] = p[1];
    p[1] = t;
}
